import {INCREMENT,DECREMENT} from "../constant/constant"

const init ={
    count : 0
}

export default function countReducer (preState = init, action) {

    const {type,data} = action;
     switch(type) {
        case INCREMENT:
            return {...init,count : preState.count + data}
    }
    switch(type) {
        case DECREMENT:
            return {...init,count : preState.count - data}
    }

    return preState;
}